package com.bj.jjz.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;


import com.bj.jjz.R;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/4/1 .15:24.
 * @Email 87683202@qq.com
 */
public class MyViewPagerAdapter extends FragmentPagerAdapter {
    List<Fragment> fragments;
    String[] string;
    Context context;
    public MyViewPagerAdapter(Context context, FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        this.context=context;
        this.fragments = fragments;
        string = new String[]{context.getString(R.string.title_home),
                context.getString(R.string.title_dashboard),
                context.getString(R.string.title_notifications)};
    }


    @Override
    public int getCount() {
        return fragments.size();
    }


    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return string[position];
    }
}
